
import service from '@/utils/request'
import type {
  CategoryBlogResponseData,
  CategoryResourceResponseData,
} from '@/api/category/type'
import { AxiosResponse } from 'axios'

enum API {
  CategoryBlog1URL = '/resource/category/selectLevel1',
  CategoryBlog2URL = '/resource/category/selectLevel1/{parentId}',
  CategoryResource1URL = '/resource/resourceType/getLevel1',
  CategoryResource2URL = '/resource/resourceType/getLevel2/{parentId}',
}

//资源一级分类展示
export const getCategoryResource1 = () =>
  service.resourceService.get<any, AxiosResponse<any>>(API.CategoryResource1URL)

//资源二级分类展示
export const getCategoryResource2 = (parentId: number) =>
  service.resourceService.get<any, AxiosResponse<CategoryResourceResponseData>>(
    API.CategoryResource2URL.replace('{parentId}', parentId),
  )
